package com.ruoyi.system.service.impl;

import java.util.List;

import cn.hutool.core.date.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ByNewsCategoryMapper;
import com.ruoyi.system.domain.ByNewsCategory;
import com.ruoyi.system.service.IByNewsCategoryService;

/**
 * 新闻分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-15
 */
@Service
public class ByNewsCategoryServiceImpl implements IByNewsCategoryService 
{
    @Autowired
    private ByNewsCategoryMapper byNewsCategoryMapper;

    /**
     * 查询新闻分类
     * 
     * @param id 新闻分类主键
     * @return 新闻分类
     */
    @Override
    public ByNewsCategory selectByNewsCategoryById(String id)
    {
        return byNewsCategoryMapper.selectByNewsCategoryById(id);
    }

    /**
     * 查询新闻分类列表
     * 
     * @param byNewsCategory 新闻分类
     * @return 新闻分类
     */
    @Override
    public List<ByNewsCategory> selectByNewsCategoryList(ByNewsCategory byNewsCategory)
    {
        return byNewsCategoryMapper.selectByNewsCategoryList(byNewsCategory);
    }

    /**
     * 新增新闻分类
     * 
     * @param byNewsCategory 新闻分类
     * @return 结果
     */
    @Override
    public int insertByNewsCategory(ByNewsCategory byNewsCategory)
    {
        byNewsCategory.setCreateDate(DateTime.now());
        return byNewsCategoryMapper.insertByNewsCategory(byNewsCategory);
    }

    /**
     * 修改新闻分类
     * 
     * @param byNewsCategory 新闻分类
     * @return 结果
     */
    @Override
    public int updateByNewsCategory(ByNewsCategory byNewsCategory)
    {
        byNewsCategory.setUpdateDate(DateTime.now());
        return byNewsCategoryMapper.updateByNewsCategory(byNewsCategory);
    }

    /**
     * 批量删除新闻分类
     * 
     * @param ids 需要删除的新闻分类主键
     * @return 结果
     */
    @Override
    public int deleteByNewsCategoryByIds(String[] ids)
    {
        return byNewsCategoryMapper.deleteByNewsCategoryByIds(ids);
    }

    /**
     * 删除新闻分类信息
     * 
     * @param id 新闻分类主键
     * @return 结果
     */
    @Override
    public int deleteByNewsCategoryById(String id)
    {
        return byNewsCategoryMapper.deleteByNewsCategoryById(id);
    }
}
